/*
 * Copyright Hundsun Technologies Inc. All Rights Reserved.
 */

package types

import "errors"

// 错误类型定义
var (
	// begin definition of elasticsearch
	//ErrEmptyIndexName ...
	ErrEmptyIndexName = errors.New("indexName cannot be empty")
	//ErrEmptyDocID ...
	ErrEmptyDocID = errors.New("key/docId cannot be empty")
	//ErrWrongDocBody ...
	ErrWrongDocBody = errors.New("wrong docBody")
	//ErrNilRequests ...
	ErrNilRequests = errors.New("requests cannot be nil")
	//ErrFailedResult ...
	ErrFailedResult = errors.New("result is not success")
	//ErrNilEsConfig ...
	ErrNilEsConfig = errors.New("es config cannot be nil")
	//ErrEmptySearchRequest ...
	ErrEmptySearchRequest = errors.New("searchRequest cannot be empty")
	//ErrEmptyBodyString ...
	ErrEmptyBodyString = errors.New("value/bodyString cannot be empty")
	//ErrResultEmptyDocument ...
	ErrResultEmptyDocument = errors.New("document result is empty")
	// end definition of elasticsearch

	//ErrNilDbInstance begin definition of db-es
	ErrNilDbInstance = errors.New("db instance cannot be nil")
	//ErrContainNilElement ...
	ErrContainNilElement = errors.New("input/output contain nil element")
	// end definition of es db-es

	//ErrChannelClosed begin definition of mq-localmq
	ErrChannelClosed = errors.New("ErrChannelClosed")
	//ErrTopicContainReservedChar ...
	ErrTopicContainReservedChar = errors.New("topic contain reserved char, such as `.` `,`")
	//ErrNotFoundMode ...
	ErrNotFoundMode = errors.New("client mode not found")
	// end definition of mq-localmq

	// begin definition of mq-rabbitmq
	//ErrNilRabbitMqConfig ...
	ErrNilRabbitMqConfig = errors.New("rabbitmq config cannot be nil")
	//ErrFailedSendMsg ...
	ErrFailedSendMsg = errors.New("failed to send msg")
	//ErrSendTimeout ...
	ErrSendTimeout = errors.New("timeout to send msg")
	//ErrWaitTimeout ...
	ErrWaitTimeout = errors.New("timeout to wait msg")
	//ErrWrongMqMode ...
	ErrWrongMqMode = errors.New("wrong mq mode")
	//ErrNilMsgID ...
	ErrNilMsgID = errors.New("msg id cannot be nil")
	//ErrNilReplyConsumer ...
	ErrNilReplyConsumer = errors.New("msg reply consumer cannot be nil")
	//ErrNilReplyMsg ...
	ErrNilReplyMsg = errors.New("reply msg is nil")

	// end definition of mq-rabbitmq

	// begin definition of check block
	// ErrNoBlockHeader block header is empty
	ErrNoBlockHeader = errors.New("blockHeader is empty")
	// ErrNoTransactions no transactions
	ErrNoTransactions = errors.New("no transactions in block")
	// ErrInvalidParentHashSize invalid parent hash size
	ErrInvalidParentHashSize = errors.New("invalid parent hash size")
	// ErrBlockTimeBeforeGenesisBlock block time before genesis block
	ErrBlockTimeBeforeGenesisBlock = errors.New("block time cannot be smaller than genesis block")
	// ErrInvalidCheckBlockNumber invalid check block number
	ErrInvalidCheckBlockNumber = errors.New("invalid check blockNumber")
	// ErrInvalidCheckBlockStateHashSize size of state hash of block is invalid
	ErrInvalidCheckBlockStateHashSize = errors.New("size of state hash of check block is invalid ")
	// ErrNonPositiveBlockNumber block number not positive
	ErrNonPositiveBlockNumber = errors.New("block number must be positive")
	// ErrInvalidBlockSignatureFormat invalid block signature
	ErrInvalidBlockSignatureFormat = errors.New("format of block signature is invalid")
	// end definition of check block

	//ErrNotAllow ..
	ErrNotAllow = errors.New("ErrNotAllow")
	//ErrNotFound ...
	ErrNotFound = errors.New("ErrNotFound")
	//ErrFailed ...
	ErrFailed = errors.New("ErrFailed")
	//ErrEmpty ...
	ErrEmpty = errors.New("ErrEmpty")
	//ErrExecPanic ...
	ErrExecPanic = errors.New("ErrExecPanic")
	//ErrNoRegistedDriver ...
	ErrNoRegistedDriver = errors.New("ErrNoRegistedDriver")
	//ErrHeightNotExisted ...
	ErrHeightNotExisted = errors.New("ErrHeightNotExisted")
	//ErrNotFoundInDb ...
	ErrNotFoundInDb = errors.New("ErrNotFoundInDb")
	//ErrInvalidParam ...
	ErrInvalidParam = errors.New("ErrInvalidParam")
	//ErrEndLessThanStart ...
	ErrEndLessThanStart = errors.New("ErrEndLessThanStart")
	//ErrMqClientNotReady ...
	ErrMqClientNotReady = errors.New("ErrMqClientNotReady")
	//ErrNoPeers ...
	ErrNoPeers = errors.New("ErrNoPeers")
	//ErrBlockHashNoMatch ...
	ErrBlockHashNoMatch = errors.New("ErrBlockHashNoMatch")
	//ErrAlreadyClosed ..
	ErrAlreadyClosed = errors.New("ErrAlreadyClosed")
	//ErrAlreadyExisted ...
	ErrAlreadyExisted = errors.New("ErrAlreadyExisted")
	//ErrInvalidSignature ...
	ErrInvalidSignature = errors.New("ErrInvalidSignature")
	//ErrInvalidSeqSignature ...
	ErrInvalidSeqSignature = errors.New("ErrInvalidSeqSignature")
	// ErrInvalidTxType
	ErrInvalidTxType = errors.New("ErrInvalidTxType")
	// ErrChainIDDifferent 链ID不一致
	ErrChainIDDifferent = errors.New("chainID is different")
	// ErrInvalidBlockTime 区块打包时间异常
	ErrInvalidBlockTime = errors.New("invalid block time")
	// ErrInvalidBlockSignature 区块签名异常
	ErrInvalidBlockSignature = errors.New("invalid block signature")
	// ErrNotSyncWithSeqCenter 区块未与seq保持同步
	ErrNotSyncWithSeqCenter = errors.New("out of sync with seq center")
)
